//////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
#include "delay.h"
#include "stm32f10x.h"
#include "sys.h"
#include "string.h"
#include "timer.h"
#include "Dbus_uart.h"
#include "usart.h"
#include "led.h"
#include "cc1101.h"
				
int main(void)
{	
	//==========================================
	RCC_init();
	delay_init();//延时函数初始化
	LED_Init();
	LED1=LED2=LED3=1;LED4=0;

	SPI_RF_Init();		/*SPI2 for CC1101 control */
	POWER_UP_RESET_CC1100();
	halRfWriteRfSettings();
	halSpiWriteBurstReg(CCxxx0_PATABLE, PaTabel, 8);
	LED2=1;
	TxBuf[7] = 0xbb ;
	delay(6000);
	while(1)
	{
		LED1=0;
		TxBuf[1] = 0xa5 ;
		halRfSendPacket(TxBuf,8);
		delay_ms(500);
		LED1=1;
		TxBuf[1] = 0xb5 ;
		halRfSendPacket(TxBuf,8);
		delay_ms(500);
	}
	
}
